<?php
/**
 * Check if login and password are correct
 * Send an object in JSON with:
 * - success: (bool) true if it is correct, false otherwise
 * - error: (string) the type of error of the connection
 */
require_once("../include/setup.php");
require_once(CONTROLLER_PATH.'mikubook.controller.php');

$login = $_REQUEST['login'];
$password = $_REQUEST['password'];

$c = new Mikubook_Video_Controller();
$successConnection = $c->connectMikubook($login, $password);

$resp = array('success' => true);
if ($successConnection !== true) {
	$resp = array(
		'success' => false,
		'error' => $successConnection
	);
}

echo json_encode($resp);
?>